package com.shilei.singleton;

/**
 * @description: 枚举单例
 *          不仅可以解决线程同步，还可以防止反序列化
 * @author: 81271
 * @date: 2020-04-12 10:02
 */
public enum  Mgr05 {
    INSTANCE;

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(() -> System.out.println(Mgr05.INSTANCE.hashCode())).start();
        }
    }
}
